package com.yexiao.cofe.business.pojo;

import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yexiao.core.util.JSONUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * @author lkl
 * @since 2025/4/8
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@TableName("permission")
public class Permission {

    /**
     * 自增主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 权限主键
     */
    @TableField(value = "permission_id")
    private String permissionId;

    /**
     * 权限名
     */
    @TableField(value = "permission_name")
    private String permissionName;

    /**
     * 父权限主键
     */
    @TableField(value = "father_permission_id")
    private String fatherPermissionId;

    /**
     * 父权限名
     */
    @TableField(value = "father_permission_name")
    private String fatherPermissionName;

    /**
     * 排序字段
     */
    @TableField(value = "sort")
    private Integer sort;

    public static final String ID = "id";
    public static final String PERMISSION_ID = "permission_id";
    public static final String PERMISSION_NAME = "permission_name";
    public static final String FATHER_PERMISSION_ID = "father_permission_id";
    public static final String FATHER_PERMISSION_NAME = "father_permission_name";
    public static final String SORT = "sort";

    public JSONObject getBaseMsg() {
        return JSONUtil.of(
                "id", this.id,
                "permissionId", this.permissionId,
                "permissionName", this.permissionName,
                "fatherPermissionId", this.fatherPermissionId,
                "fatherPermissionName", this.fatherPermissionName,
                "sort", this.sort
        );
    }
}
